<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="shortcut icon" href="<!--{eval echo register_static('img/touch-icon-57x57.png');}-->">
    <title>粉粉管理系统</title>

    <!-- Bootstrap core CSS -->
    <link href="<!--{eval echo register_static('css/bootstrap.min.css');}-->" rel="stylesheet">

    <link href="<!--{eval echo register_static('css/bootstrap-reset.css');}-->" rel="stylesheet">
    <!--Animation css-->
    <link href="<!--{eval echo register_static('css/animate.css');}-->" rel="stylesheet">
    <!--Icon-fonts css-->
    <link href="<!--{eval echo register_static('assets/font-awesome/css/font-awesome.css');}-->" rel="stylesheet" />
    <link href="<!--{eval echo register_static('assets/ionicon/css/ionicons.min.css');}-->" rel="stylesheet" />
    <link href="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.css');}-->" rel="stylesheet">
    <!-- Plugins css -->
    <link href="<!--{eval echo register_static('assets/modal-effect/css/component.css');}-->" rel="stylesheet">
    <!-- DataTables -->
    <link rel="stylesheet" href="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.css" rel="stylesheet');}-->" />
    <!-- Custom styles for this template -->
    <link href="<!--{eval echo register_static('css/style.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('css/helper.css');}-->" rel="stylesheet">
    <!-- My styles for this template -->
    <link href="<!--{eval echo register_static('css/common.css');}-->" rel="stylesheet"></head>

<body id="mybody">

    <!-- Aside Start-->
    <!--{template admin_v2/leftside}-->
    <!-- Aside Ends-->

    <!--Main Content Start -->
    <section class="content">

        <!-- Header -->
        <!--{template admin_v2/header}-->
        <!-- Header Ends -->

        <!-- Page Content Start -->
        <!-- ================== -->

        <div class="wraper container-fluid user-list">

            <div class="row">
                <div class="col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">账号操作</h3>
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-md-4 col-sm-4 col-xs-4">
                                	<div class="form-inline" role="form">
                                        <div class="form-group m-l-10">
                                            <select name="type"  class="form-control" id="searchType">
                                                <option value="uid">UID</option>
                                                <option value="account">注册账户</option>
                                                <option value="email">注册邮箱</option>
                                            </select>
                                            <input type="text" name="searchValue" id="searchValue" class="form-control"></div>
                                        <button type="button" id="search"  class="btn btn-success m-l-10">点击搜索</button>
                                    </div>
                                </div>
                            </div>
                            <br/>
                            <div class="row" id="tbody_list">

                            </div>

                            <div class="row" id="tbody_userStatistics">

                            </div>
                        </div>
                        </div>
                        </div>
                    </div>

                </div>
                <!-- Footer Start -->
                <!--{template admin_v2/footer}-->
                <!-- Footer Ends --> </section>
            <!-- Main Content Ends -->

            <!-- js placed at the end of the document so the pages load faster -->
            <script src="<!--{eval echo register_static('js/jquery.js');}-->"></script>
            <script src="<!--{eval echo register_static('js/bootstrap.min.js');}-->"></script>

            <script src="<!--{eval echo register_static('js/pace.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('js/wow.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('js/jquery.nicescroll.js');}-->" type="text/javascript"></script>

            <script src="<!--{eval echo register_static('js/jquery.app.js');}-->"></script>

            <script src="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/datatables/dataTables.bootstrap.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.init.js');}-->"></script>

            <!-- Modal-Effect -->
            <script src="<!--{eval echo register_static('assets/modal-effect/js/classie.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/modal-effect/js/modalEffects.js');}-->"></script>

            <!--layui-->
            <script src="<!--{eval echo register_static('layer/layer.js');}-->"></script>
            <script src="<!--{eval echo register_static('laytpl/laytpl.js');}-->"></script>
             <script type="text/html" id="user_panel">
                 <div class="col-md-3 col-sm-12 col-xs-12 user-info-left span5" >
                     <table id="datatable" class="table table-striped table-bordered">
                         <thead>
                         <tr>
                             <th>AutoUid</th><th>Description</th>
                         </tr>
                         </thead>
                         <tbody>
                         <tr>
                             <th>UID</th><td>{{d.userinfo.uid}}</td>
                         </tr>
                         <tr>

                             <th>账户</th><td>
                             <div class="btn-group btn-group-sm">
                                 <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
                                     账号<span class="caret"></span>
                                 </button>
                                 <ul class="dropdown-menu" role="menu">
                                     {{laytpl.accounts(d.userinfo.accounts)}}
                                 </ul>
                             </div>
                         </td>
                         </tr>
                         <tr>
                             <th>平台</th><td>{{d.userinfo.platform}}</td>
                         </tr>
                         <tr>
                             <th>昵称</th><td>{{d.userinfo.nickname}}</td>
                         </tr>
                         <tr>
                             <th>邮箱</th><td>{{d.userinfo.email}}</td>
                         </tr>
                         <tr>
                             <th>设备信息</th><td>{{d.userinfo.registerDevice}}</td>
                         </tr>
                         <tr>
                             <th>注册时间</th><td>{{laytpl.dateTime(d.userinfo.registerTime)}}</td>
                         </tr>
                         <tr>
                             <th>注册IP</th><td>{{d.userinfo.registerIp}}</td>
                         </tr>
                         <tr>
                             <th>状态</th><td>{{laytpl.status(d.userinfo.status)}}</td>
                         </tr>
                         <tr>
                             <th>操作</th><td>
                             <div class="btn-group btn-group-sm">
                                 <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
                                     操作<span class="caret"></span>
                                 </button>
                                 <ul class="dropdown-menu" role="menu">
                                     {{laytpl.phoneBind(d.userinfo.uid,d.userinfo.account)}}
                                 </ul>
                             </div>
                         </td>
                         </tr>
                         </tbody>
                     </table>
                 </div>
                 <div class="col-md-3 col-sm-12 col-xs-12 user-info-left span6" style="margin-left:25px">
                     <table id="datatable_usermember" class="table table-striped table-bordered">
                         <thead>
                         <tr>
                             <th>userMember</th><th>Description</th>
                         </tr>
                         </thead>
                         <tbody>
                             <tr>
                                  <th>UID</th><td>{{d.usermember.uid}}</td>
                             </tr>
                             <tr>
                                 <th>剩余流量(M)</th><td>{{laytpl.traffic(d.usermember.traffic)}}</td>
                             </tr>
                             <tr>
                                 <th>等级流量(M)</th><td>{{laytpl.traffic(d.usermember.allTraffic)}}</td>
                             </tr>
                             <tr>
                                 <th>购买流量(M)</th><td>{{laytpl.traffic(d.usermember.buyTraffic)}}</td>
                             </tr>
                             <tr>
                                 <th>会员流量(M)</th><td>{{laytpl.traffic(d.usermember.vipTraffic)}}</td>
                             </tr>
                             <tr>
                                 <th>等级</th><td>{{d.usermember.level}}</td>
                             </tr>
                             <tr>
                                 <th>经验</th><td>{{d.usermember.exp}}</td>
                             </tr>
                             <tr>
                                 <th>操作</th>
                                 <td>
                                     <div class="btn-group btn-group-sm">
                                         <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
                                             操作<span class="caret"></span>
                                         </button>
                                         <ul class="dropdown-menu" role="menu">
                                             {{laytpl.trafficAction(d.usermember.uid)}}
                                         </ul>
                                     </div>
                                 </td>
                             </tr>
                         </tbody>
                     </table>
                 </div>

             </script>
            <script type="text/html" id="user_statistics">
                <div class="col-md-3 col-sm-12 col-xs-12 user-info-left span5">
                    <table class="table table-bordered table-striped">
                        <colgroup>
                            <col class="span1">
                            <col class="span3">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>用户</th>
                            <th>Description</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <th>UID</th>
                            <td class="uidValue">{{d.userInfo.uid}}</td>
                        </tr>
                        </tbody>
                        <tbody>
                        <tr>
                            <th>昵称</th>
                            <td>{{d.userInfo.nickname}}</td>
                        </tr>
                        </tbody>
                        <tbody>
                        <tr>
                            <th>签名</th>
                            <td>{{d.userInfo.signature}}</td>
                        </tr>
                        </tbody>
                        <tbody>
                        <tr>
                            <th>注册</th>
                            <td>{{d.userInfo.registerDate}}</td>
                        </tr>
                        </tbody>
                        <tbody>
                        <tr>
                            <th>性别</th>
                            <td>
                                <!--{if d.userInfo.sex == 0}-->
                                男<!--{else}-->女
                                <!--{/if}-->
                            </td>
                        </tr>
                        </tbody>
                        <tbody>
                        <tr>
                            <th>达人</th>
                            <td>
                                {{d.userInfo.is_ability}}
                            </td>
                        </tr>
                        </tbody>
                        <tbody>
                        <tr>
                            <th>生日</th>
                            <td>{{d.userInfo.birthday}}</td>
                        </tr>
                        </tbody>
                        <tbody>
                        <tr>
                            <th>关注</th>
                            <td>
                                {{d.userInfo.is_mefollow}}
                            </td>
                        </tr>
                        </tbody>
                        <tbody>
                        <tr>
                            <th>经验值</th>
                            <td>
                                {{d.userMember.level}}级【经验值{{d.userMember.exp}}/{{d.userMember.nextLevelExp}}】
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>

                <div class="col-md-3 col-sm-12 col-xs-12 user-info-left span6">
                    <table id="datatable_userStatistics" class="table table-striped table-bordered">
                        <thead>
                        <tr>
                            <th>userStatistics</th><th>Description</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <th>UID</th><td>{{d.userStatistics.uid}}</td>
                        </tr>
                        <tr>
                            <th>点滴</th><td>{{d.userStatistics.diaryTimes}}</td>
                        </tr>
                        <tr>
                            <th>话题</th><td>{{d.userStatistics.topicTimes}}</td>
                        </tr>
                        <!--<tr>-->
                            <!--<th>精华话题数</th><td>{{d.userStatistics.topicTimes}}</td>-->
                        <!--</tr>-->
                        <tr>
                            <th>私密</th><td>{{d.userStatistics.secretDiaryTimes}}</td>
                        </tr>
                        <tr>
                            <th>关注</th><td>{{d.userStatistics.meFollowTimes}}</td>
                        </tr>
                        <tr>
                            <th>粉丝</th><td>{{d.userStatistics.followMeTimes}}</td>
                        </tr>
                        <tr>
                            <th>评论数</th><td>{{d.userStatistics.commentTimes}}</td>
                        </tr>
                        <tr>
                            <th>被评论数</th><td>{{d.userStatistics.commentMeTimes}}</td>
                        </tr>
                        <tr>
                            <th>喜欢数</th><td>{{d.userStatistics.likeTimes}}</td>
                        </tr>
                        <tr>
                            <th>被喜欢数</th><td>{{d.userStatistics.likeMeTimes}}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>

                <div class="col-md-3 col-sm-12 col-xs-12  user-info-left span6" style="width: 30%">
                    <table class="table table-bordered table-striped">
                        <colgroup>
                            <col class="span1">
                            <col class="span5">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>管理</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <th>禁言管理</th>
                            <td>
                                <form id="shutUpUser" class="form-inline" method="get" action="admin.php" >
                                    <input type='text' name='time' class="form-control" placeholder="禁言天数"/>
                                    <input type='hidden' name='uid' value="$_GET[uid]"/>
                                    <input type='hidden' name='op' value='actionManage'/>
                                    <input type='hidden' name='action' value='shutUpUser'/>
                                    <input type='hidden' name='ac' value='manage'/>
                                    <button type="button" class="btn jinzhishuoming btn-primary btn-small">禁言</button>
                                </form>
                            </td>
                        </tr>
                        <tr id="jybz">
                            <th>禁言备注</th>
                            <td id="jybzMsg">
                                {$jybz}
                            </td>
                        </tr>
                        <tr>
                            <th>重置密码</th>
                            <td>
                                <form class="form-inline" method="get" action="admin.php" >
                                    <input type="text" name="passwd" class="form-control" placeholder="新密码" value="">
                                    <input type="hidden" name="uid" value="$_GET[uid]" />
                                    <input type="hidden" name="ac" value="user_profile" />
                                    <input type="hidden" name="op" value="modifyUserPasswd" />
                                    <button type="submit" class="btn btn-primary btn-small">提交</button>
                                </form>
                            </td>
                        </tr>
                        <tr>
                            <th>修改经验</th>
                            <td>
                                <button id="changeUser" href="#changeUserExp" role="button" class="btn btn-primary btn-small">修改经验</button>
                            </td>
                        </tr>
                        <tr>
                            <th>修改金币</th>
                            <td>
                                <button id="changeUserCoin" href="#changeUserCoin" role="button" class="btn btn-primary btn-small">修改金币</button>
                            </td>
                        </tr>
                        <tr {{d.userInfo.level}}>
                            <th>修改达人等级</th>
                            <td>
                                <button id="changeAbilityLevel" href="#changeAbilityLevel" role="button" class="btn btn-primary btn-small">修改达人等级</button>
                            </td>
                        </tr>
                        <tr>
                            <th>点击加入达人(堂)</th>
                            <td>
                                <button id="addAbilityAndExpert" href="#addAbilityAndExpert" role="button" class="btn btn-primary btn-small">点击成为达人</button>
                            </td>
                        </tr>
                        <tr>
                            <th>删除用户所有日记</th>
                            <td>
                                <button class="btn btn-primary btn-small delAllDiary" >删除用户所有日记</button>
                            </td>
                        </tr>
                        <tr>
                            <th>删除用户所有日记评论</th>
                            <td>
                                <button class="btn btn-primary btn-small removeAllComment" >删除用户所有日记评论</button>
                            </td>
                        </tr> 
                        <tr>
                            <th>恢复用户所有日记</th>
                            <td>
                                <button class="btn btn-primary btn-small restoreAllDiary" >恢复用户所有日记</button>
                            </td>
                        </tr>
						<tr>
                            <th>封禁用户</th>
                            <td>
                                <button class="btn btn-primary btn-small chainUser" data-uid="{{d.userInfo.uid}}" data-status="1">封禁用户</button>
                                <button class="btn btn-primary btn-small chainUser" data-uid="{{d.userInfo.uid}}" data-status="0">取消封禁</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div>
                    <ul class="thumbnails" style="list-style: none">
                        <li><a href="admin.php?ac=diary_class&op=getUserDiaryList&uid={{d.userInfo.uid}}" target="_blank" class="btn btn-primary btn-small">点击查看用户点滴列表</a></li>
                        <li style="margin-top:10px;"><a href="admin.php?ac=diarytopic_class&op=getDiaryTopics&type=1&uid={{d.userInfo.uid}}" target="_blank" class="btn btn-primary btn-small">点击查看用户话题列表</a></li>
                    </ul>
                </div>
            </script>
            <script type="text/javascript" src="static_v2/js/jquery.js"></script>
            <script type="text/javascript" src="static_v2/layer/layer.js"></script>
            <script type="text/javascript" src="static_v2/laytpl/laytpl.js"></script>
            <script type="text/html" id="jinyan">
                <form action="">
                    <label>选项</label><br>
                    <select name="" id="jinyan_msg" style="height: 26px;">
                        <option value="">无</option>
                        <option value="发布垃圾广告">发布垃圾广告</option>
                        <option value="虚假中奖">虚假中奖</option>
                        <option value="淫秽色情">淫秽色情</option>
                        <option value="敏感信息">敏感信息</option>
                        <option value="隐私泄露">隐私泄露</option>
                        <option value="不实消息">不实消息</option>
                        <option value="冒充他人">冒充他人</option>
                        <option value="骚扰他人">骚扰他人</option>
                        <option value="内容抄袭">内容抄袭</option>
                        <option value="人身攻击">人身攻击</option>
                        <option value="恶意刷屏">恶意刷屏</option>
                    </select><br>
                    <label>UID</label><br><input type="text" id="jinyan_id" name="uid" value="{$_GET['uid']}" class="form-control"><br>
                    <label>补充说明:</label><br><textarea cols="10" rows="5" id="buchong" class="form-control"></textarea>
                </form>
            </script>
            <script type="text/template" id="changeUserExp">
                <form action="admin.php?ac=user_profile&op=modifyUserLevelExp" method="post">
                    <div class="modal-body nav-category">
                        <div class="control-group">
                            <label class="control-label" for="exp">增加(减少)经验值</label>
                            <div class="controls">
                                <input type="text" name="exp" id="exp" class="form-control" placeholder="经验值,减经验值填写负数" value="">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="contente">通知编辑</label>
                            <div class="controls">
                                <textarea style="width: 500px; height: 100px;" class="form-control" name='content' id="contente" placeholder="通知内容填写"></textarea>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary changeUserExpPost">提交</button>
                    </div>
                </form>
            </script>
            <script type="text/template" id="changeGold">
                <form action="admin.php" method="get">
                    <div class="modal-body nav-category">
                        <div class="control-group">
                            <label class="control-label" for="coin">增加(减少)金币值</label>
                            <div class="controls">
                                <input type="text" name="coin"  id="coin" class="form-control" placeholder="每次最高加200粉币" value="">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="content">通知编辑</label>
                            <div class="controls">
                                <textarea style="width: 500px; height: 100px;" class="form-control" name='content' id="content" placeholder="通知内容填写"></textarea>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary changeGoldPost">提交</button>
                    </div>
                </form>
            </script>
            <script type="text/template" id="changeAbilityLevelModal">
                <form action="admin.php" method="get">
                    <div class="modal-body nav-category">
                        <div class="control-group">
                            <label class="control-label" for="level">修改达人等级</label>
                            <div class="controls">
                                <input type="text" name="level" id="level" class="form-control" placeholder="填写的值为修改后显示的值" value="">
                            </div>
                            <div class="control-group">
                                <label class="control-label" for="label">达人类别</label>
                                <div class="controls">
                                    <select name='label' class="span2 form-control" id="label" style="height: 40px; width: 100%">
                                        <option value='1'>情感达人</option>
                                        <option value='5'>健康达人</option>
                                        <option value='6'>美妆达人</option>
                                        <option value='7'>星座达人</option>
                                        <option value='9'>摄影达人</option>
                                        <option value='10'>搞笑达人</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <input type='hidden' name='status' value='1'/>
                        <button type="button" class="btn btn-primary addAbilityAndExpertPost">提交</button>
                    </div>
                </form>
            </script>
            <script type="text/template" id="addAbilityAndExpertModal">
                <form action="admin.php" method="get">
                    <div class="modal-body nav-category">
                        <div class="control-group">
                            <label class="control-label" for="label">达人类别</label>
                            <div class="controls">
                                <select name='label' class="span2" id="label" style="height: 26px;">
                                    <option value='1'>情感达人</option>
                                    <option value='5'>健康达人</option>
                                    <option value='6'>美妆达人</option>
                                    <option value='7'>星座达人</option>
                                    <option value='9'>摄影达人</option>
                                    <option value='10'>搞笑达人</option>
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="introduction">达人宣言</label>
                            <div class="controls">
                                <textarea style="width: 500px; height: 100px;" class="form-control" name='introduction' id="introduction" placeholder="达人宣言"></textarea>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <input type='hidden' name='status' value='1'/>
                        <button type="button" class="btn btn-primary addAbilityAndExpertPost">添加</button>
                    </div>
                </form>
            </script>
            <script type="application/javascript">
                $(document).ready(function() {
                    var uid=GetQueryString('uid');
                    if(uid !=null && uid.toString().length>1)
                    {
                        var data = {};
                        data['type'] = 'uid';
                        data['value'] = uid;
                        data['uid'] = uid;
                        request(data,accountOperation);
                        RequestList(data,userStatistics);
                    }
                    // 设置table配置
                    $('#datatable').dataTable({
                        "iDisplayLength": 50,
                        "aLengthMenu": [10, 20, 50, 100],
                        "searching": false,
                        "bLengthChange": false,
                        "bSort": false,
                        "bPaginate": false
                    });
                    $.fn.serializeObject = function(){
                        var o = {};
                        var a = this.serializeArray();
                        $.each(a, function() {
                            if (o[this.name] !== undefined) {
                                if (!o[this.name].push) {
                                    o[this.name] = [o[this.name]];
                                }
                                o[this.name].push(this.value || '');
                            } else {
                                o[this.name] = this.value || '';
                            }
                        });
                        return o;
                    };
                });

                function GetQueryString(name)
                {
                    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
                    var r = window.location.search.substr(1).match(reg);
                    if(r!=null)return  unescape(r[2]); return null;
                }

                //重置个人基本信息
                $(document).off('click','.resetUserInfo').on('click','.resetUserInfo',function(){
                    var data = {uid:$(this).data('uid'),account:$(this).data('account'),action:'resetUserInfo'};
                    layer.confirm('确认操作!', {
                        btn: ['YES','NO'],icon: 3, title:'提醒'
                    }, function(){
                        request(data, resDisplay);
                    });
                })

                //手机号注销
                $(document).off('click','.cancelAccount').on('click','.cancelAccount',function(){
                    var data = {uid:$(this).data('uid'),account:$(this).data('account'),action:'cancelAccount'};
                    layer.confirm('确认操作!', {
                        btn: ['YES','NO'],icon: 3, title:'提醒'
                    }, function(){
                        request(data, resDisplay)
                    });
                });

                $(document).on('click','.resetTraffic',function () {
                    var data = {uid:$(this).data('uid'),action:'resetUserTraffic'};
                    layer.confirm('确认操作!', {
                        btn: ['YES','NO'],icon: 3, title:'提醒'
                    }, function(){
                        request(data, resDisplay)
                    });

                })
                $(document).off('click','#search').on('click','#search', function () {
                   var data = {};
                   data['type'] = $('#searchType').val();
                   data['value'] = $('#searchValue').val();
                    request(data,accountOperation);
                    if(data['type'] == 'uid'){
                        RequestList(data,userStatistics);
                    }
                });

                var accountOperation= function(data){
                    if($.isEmptyObject(data) || data ===undefined || data ===false){
                        $('#content').empty();
                        return;
                    }
                    var user_panel = $('#user_panel').html();
                    laytpl(user_panel).render(data, function(html){
                        $('#tbody_list').html(html);
                    });
                };
                var userStatistics= function(data){
                    if($.isEmptyObject(data) || data ===undefined || data ===false){
                        $('#content').empty();
                        return;
                    }
                    var user_statistics = $('#user_statistics').html();
                    laytpl(user_statistics).render(data, function(httml){
                        $('#tbody_userStatistics').html(httml);
                    });
                };
                var request = function(data, func, method, url){
                    layer.load();
                    url    ? url    : url    = 'admin.php?ac=admin';
                    method ? method : method = 'GET';
                    data['action'] ? data['action'] : data['action'] = 'searchUser';

                    data['do'] = 'accountOperation';
                    data['op'] = 'start';
                    $.ajax({
                        dataType : 'json',
                        url  : url,
                        type : method,
                        data : data,
                        success: function(returnData){
                            layer.closeAll();
                            func(returnData.result);
                        }
                    });
                }
                var RequestList = function(data, func, method, url){
                    layer.load();
                    url    ? url    : url    = 'admin.php?ac=admin';
                    method ? method : method = 'GET';
                    data['uid'] = data['uid'] ? data['uid'] : $('#searchValue').val() ;
                    data['status'] = data['status'] ? data['status'] : '0' ;
                    data['action'] = 'getUserInfo';
                    data['do'] = 'getUserInfo';
                    data['op'] = 'start';
                    $.ajax({
                        dataType : 'json',
                        url  : url,
                        type : method,
                        data : data,
                        success: function(returnData){
                            layer.closeAll();
                            decideStr(returnData.result);
                            func(returnData.result);
                        }
                    });
                }
                //判断
                function decideStr(d) {
                    //签名
                    if(!d.userInfo.signature)
                    {
                        d.userInfo.signature='暂无签名';
                    }
                    //性别
                    if(d.userInfo.sex==1){
                        d.userInfo.sex = '男';
                    }else {
                        d.userInfo.sex = '女';
                    }
                    //达人
                    if(d.userInfo.is_ability==0){
                        d.userInfo.is_ability = 'NO';
                        d.userInfo.level = "style='display:none'";
                    }else {
                        d.userInfo.is_ability = 'YES';
                        d.userInfo.level = "";
                    }
                    //关注
                    if(d.userInfo.is_mefollow == 0){
                        d.userInfo.is_mefollow = 'NO';
                    }else {
                        d.userInfo.is_mefollow = 'YES';
                    }
                }

               var resDisplay = function(data){
                   var str = '';
                   if(data == true){
                       str = '操作成功!';
                   }else{
                       str = '操作失败!';
                   }
                   setTimeout(function(){
                       layer.msg(str);
                       window.location.href="admin.php?ac=admin&do=accountOperation";
                   },1000);
               }
                laytpl.status = function(status){
                    var str = '';
                    switch (status){
                        case '1':
                            str = '已封禁';
                            break;
                        case '0':
                            str = '正常';
                            break;
                    }
                    return str;
                }
                laytpl.dateTime= function (time) {
                    return new Date(parseInt(time) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
                }
                laytpl.phoneBind = function(uid, account){
                     var str ='';
                        str+='<li><a href="javascript:void(0)" data-uid='+uid+' data-account='+account+' class="cancelAccount">手机号/第三方账号注销</a></li>' +
                                    '<li><a href="javascript:void(0)" data-uid='+uid+' data-account='+account+' class="resetUserInfo">重置个人基本信息</a></li>' ;
                    return str;
                }
                laytpl.trafficAction = function(uid){
                    var str='';
                    str+='<li><a href="javascript:void(0)" data-uid='+uid+' class="resetTraffic">重置流量</a></li>';
                    return str;
                }
                laytpl.accounts = function (account) {
                    var str = ''
                    for(i in account){
                       str+='<li><a href="javascript:void(0)">'+account[i]+'</a></li>'
                    }
                    return str;
                }
                laytpl.traffic=function(a){
                    return parseInt(a/1024);
                }
                //禁言
                $(document).off('click','.jinzhishuoming').on('click','.jinzhishuoming', function () {
                    layer.open({
                        content:$('#jinyan').html(),
                        yes:function () {
                            var a = $('#buchong').val()
                            var b = $('#jinyan_msg').val()
                            var uid = $('#jinyan_id').val()
                            var msg = '';
                            if(a){
                                msg = a;
                            }else{
                                msg = b;
                            }
                            var url ='admin.php?ac=user_profile&op=jinyanmsg&msg='+msg+'&uid='+uid;
                            $.ajax({
                                type:'GET',
                                url:url,
                                dataType:'json',
                                success: function (data) {
                                    if(data == 1){
                                        $('#shutUpUser').submit();
                                    }
                                }
                            })
                        }
                    })
                });
                //修改经验
                $(document).off('click','#changeUser').on('click','#changeUser', function () {
                    layer.open({
                        content:$('#changeUserExp').html(),
                        type: 1,
                        title: '经验值修改',
                        closeBtn: 1,
                        area:['30%', '45%'],
                        shadeClose: true
                    })
                });
                $(document).off('click','.changeUserExpPost').on('click','.changeUserExpPost', function () {
                    var data = {};
                    var uid = GetQueryString('uid');
                    var uidValue = $('.uidValue').html();
                    var exp = $('#exp').val();
                    data['uid'] = uid ? uid : uidValue ;
                    data['exp'] = exp ;
                    data['action'] = 'changeExpLevel';
                    data['do'] = 'changeExpLevel';
                    data['op'] = 'start';
                    $.ajax({
                        dataType : 'json',
                        url  : 'admin.php?ac=admin',
                        type : 'GET',
                        data : data,
                        success: function(r){
                           if(r._code == 1){
                               setTimeout(function(){
                                   layer.msg('操作成功');
                                   window.location.reload();
                               },1000);
                           }
                        }
                    });
                });
                //修改金币
                $(document).off('click','#changeUserCoin').on('click','#changeUserCoin', function () {
                    layer.open({
                        content:$('#changeGold').html(),
                        type: 1,
                        title: '金币值修改',
                        closeBtn: 1,
                        area:['30%', '60%'],
                        shadeClose: true
                    })
                });
                $(document).off('click','.changeGoldPost').on('click','.changeGoldPost', function () {
                    var data = {};
                    var uid = GetQueryString('uid');
                    var uidValue = $('.uidValue').html();
                    var coin = $('#coin').val();
                    data['uid'] = uid ? uid : uidValue ;
                    data['mUid'] = uid ? uid : uidValue ;
                    data['task'] = 'system_award' ;
                    data['action'] = 'doTask';
                    data['coin'] = coin;
                    data['do'] = 'doTask';
                    data['op'] = 'start';
                    $.ajax({
                        dataType : 'json',
                        url  : 'admin.php?ac=admin',
                        type : 'GET',
                        data : data,
                        success: function(r){
                            if(r._code == 1){
                                setTimeout(function(){
                                    layer.msg('操作成功');
                                    window.location.reload();
                                },1000);
                            }
                        }
                    });
                });
                //修改达人等级
                $(document).off('click','#changeAbilityLevel').on('click','#changeAbilityLevel', function () {
                    layer.open({
                        content:$('#changeAbilityLevelModal').html(),
                        type: 1,
                        title: '修改达人等级',
                        closeBtn: 1,
                        area:['30%', '60%'],
                        shadeClose: true
                    })
                });
                //点击成为达人
                $(document).off('click','#addAbilityAndExpert').on('click','#addAbilityAndExpert', function () {
                    layer.open({
                        content:$('#addAbilityAndExpertModal').html(),
                        type: 1,
                        title: '点击加入达人及名人堂',
                        closeBtn: 1,
                        area:['30%', '60%'],
                        shadeClose: true
                    })
                });
                $(document).off('click','.addAbilityAndExpertPost').on('click','.addAbilityAndExpertPost', function () {
                    var data = {};
                    var uid = GetQueryString('uid');
                    var uidValue = $('.uidValue').html();
                    var status = $("input[name='status']").val();
                    var label = $("#label option:selected").val();
                    var level = $('#level').val();
                    data['uid'] = uid ? uid : uidValue ;
                    data['label'] = label ? label : '1' ;
                    level = level ? level : '1' ;
                    if(level){data['medal_id'] = level;}
                    data['status'] = status ? status : '1' ;
                    data['action'] = 'setAbility';
                    data['do'] = 'ability';
                    data['op'] = 'start';
                    $.ajax({
                        dataType : 'json',
                        url  : 'admin.php?ac=admin',
                        type : 'GET',
                        data : data,
                        success: function(r){
                            if(r._code == 1){
                                setTimeout(function(){
                                    layer.msg('操作成功');
                                    window.location.href="admin.php?ac=admin&do=masterAuth";
                                },1000);
                            }
                        }
                    });
                });
                //删除用户所有日记
                $(document).off('click','.delAllDiary').on('click','.delAllDiary', function () {
                    var data = {};
                    var uid = GetQueryString('uid');
                    var uidValue = $('.uidValue').html();
                    data['uid'] = uid ? uid : uidValue ;
                    data['action'] = 'delAllDiary';
                    data['do'] = 'delAllDiary';
                    data['op'] = 'start';
                    $.ajax({
                        dataType : 'json',
                        url  : 'admin.php?ac=admin',
                        type : 'GET',
                        data : data,
                        success: function(r){
                            if(r._code == 1){
                                setTimeout(function(){
                                    layer.msg('操作成功');
                                    window.location.reload();
                                },1000);
                            }
                        }
                    });
                });
                //删除用户所有日记评论
                $(document).off('click','.removeAllComment').on('click','.removeAllComment', function () {
                    var data = {};
                    var uid = GetQueryString('uid');
                    var uidValue = $('.uidValue').html();
                    data['uid'] = uid ? uid : uidValue ;
                    data['action'] = 'removeAllComment';
                    data['do'] = 'removeAllComment';
                    data['op'] = 'start';
                    $.ajax({
                        dataType : 'json',
                        url  : 'admin.php?ac=admin',
                        type : 'GET',
                        data : data,
                        success: function(r){
                            if(r._code == 1){
                                setTimeout(function(){
                                    layer.msg('操作成功');
                                    window.location.reload();
                                },1000);
                            }
                        }
                    });
                });
                //恢复用户所有日记
                $(document).off('click','.restoreAllDiary').on('click','.restoreAllDiary', function () {
                    var data = {};
                    var uid = GetQueryString('uid');
                    var uidValue = $('.uidValue').html();
                    data['uid'] = uid ? uid : uidValue ;
                    data['action'] = 'restoreAllDiary';
                    data['do'] = 'restoreAllDiary';
                    data['op'] = 'start';
                    $.ajax({
                        dataType : 'json',
                        url  : 'admin.php?ac=admin',
                        type : 'GET',
                        data : data,
                        success: function(r){
                            if(r._code == 1){
                                setTimeout(function(){
                                    layer.msg('操作成功');
                                    window.location.reload();
                                },1000);
                            }
                        }
                    });
                });
                //禁封/解封用户
                $(document).off('click','.chainUser').on('click','.chainUser', function () {
                    var uid = $(this).data('uid');
                    var status = $(this).data('status');
                    $.ajax({
                        dataType : 'json',
                        url  : 'admin.php?ac=user_class&op=chainUser',
                        type : 'GET',
                        data : {uid:uid,status:status},
                        success: function(res){
                            if(res){
                                setTimeout(function(){
                                    layer.msg('操作成功');
                                    window.location.reload();
                                },1000);
                            }
                        }
                    });
                });

             </script>
</body>
        </html>